package com.bdf.ipharma.gui;

import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import com.bdf.ipharma.starter.McdError;

/**
 * A Swing-based button class.
 * IPHARMA 2011
 * @author jmazzetti
 */
public class GUIPanelImage extends JPanel
{
  /**
   * Attributes
   */
  ImageIcon image;

  /**
   * Constructs a new instance.
   */
  public GUIPanelImage( ImageIcon pImg )
  {
    super();
    try
    {
      image = pImg;
      jbInit();
    }
    catch (Exception e)
    {
      McdError.add( e );
    }
  }

  /**
   * Initializes the state of this instance.
   */
  private void jbInit() throws Exception
  {
    setOpaque( false );
  }

  public void paintComponent( Graphics g )
	{
    g.drawImage( image.getImage(), 0, 0, null );
    super.paintComponent( g );
  }
}
